package com.example.mapstruct.network;

import com.example.mapstruct.entity.vo.ApiResult;
import com.example.mapstruct.network.model.SealType;
import com.github.lianjiatech.retrofit.spring.boot.annotation.RetrofitClient;
import lombok.Data;
import retrofit2.Call;
import retrofit2.http.*;

import java.util.List;
import java.util.Map;

/**
 * 测试网络请求框架
 *
 * @author linx
 */

@RetrofitClient(baseUrl = "${test.base-url}")
public interface TestApi {
    @Data
    class SealType {
        private Integer id;
        private String name;
    }

    /**
     * 测试
     *
     * @return
     */
    @GET("/api/v1/seal-type/simple")
    ApiResult<List<SealType>> get(@Query("name") String name);


    /**
     * de
     *
     * @param sealType
     * @param token
     * @return
     */
    @POST("/api/v1/seal-type/simple")
    ApiResult<List<SealType>> body(@Body SealType sealType, @Header("token") String token);

    /**
     * de
     *
     * @param name
     * @param id
     * @return
     */
    default ApiResult<List<SealType>> body(String name, Integer id) {
        SealType sealType = new SealType();
        sealType.setId(id);
        sealType.setName(name);
        return body(sealType, "token");
    }


}
